using System;
using System.Collections.Generic;
using System.Text;

using Stocks;
namespace StockDownloader.Persistance
{
    public class DateInclusionEvaluator : Evaluation
    {

        #region Evaluation Members
        private DateTime _startDate;
        private DateTime _endDate;
        private string _symbol;
        public DateInclusionEvaluator(DateTime StartDate, DateTime EndDate, string Symbol)
        {
            _startDate = StartDate;
            _endDate = EndDate;
            _symbol = Symbol;
        }
        public void evaluate(Candidate candidate)
        {
            bool greaterThanStart = false;
            bool lessThanEnd = false;
            StockInstantData sid = (StockInstantData)candidate.getObject();
            if (sid.DateTime >= _startDate) greaterThanStart = true;
            if (sid.DateTime <= _endDate) lessThanEnd = true;
            
            candidate.include(greaterThanStart && lessThanEnd && sid.Symbol == _symbol);
            
            
        }

        #endregion
    }
}
